<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>角色列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片区 -->
    <el-card>
      <el-button type="primary">添加角色</el-button>
      <roles-table :rolesList="rolesList" />
    </el-card>
  </div>
</template>

<script>
import RolesTable from './rolesChild/RolesTable.vue'
export default {
  components: {
    RolesTable,
  },
  name: 'Roles',
  data() {
    return {
      rolesList: [],
    }
  },
  methods: {
    async getRolesList() {
      const { data: res } = await this.$http.get('roles')
      if (res.meta.status !== 200) {
        return this.$message.error('获取角色信息失败')
      }

      this.rolesList = res.data
      console.log(this.rolesList)
    },
  },
  created() {
    this.getRolesList()
  },
}
</script>

<style>
</style>